<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/9
  Time: 11:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
      integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<HTML>
<head>
  <title>展示书籍列表</title>
</head>


<body style="background-image: url('${pageContext.request.contextPath}/images/008.jpg')">
  <table align="center" style="background-color: aqua" class="table-bordered">
    <div style="text-align: center">
      <form action="${pageContext.request.contextPath}/app/book/searchBookByName">
        <input type="text" name="name" value="">
        <input type="text" name="start" value="1" hidden="true"/>
        <input type="submit" value="搜索书籍">
      </form>
      <hr>
      <a href="${pageContext.request.contextPath}/app/book/sendToAddMessage" style="text-decoration: none">增添书籍信息</a>
    </div>
    <tr>
            <td align="center" width="5px">
              书籍序列号
            </td>
            <td align="center" width="30px">
              书籍名称
            </td>
            <td align="center" width="20px">
              作者
            </td>
            <td align="center" width="30px">
              图片
            </td>
            <td align="center" width="50px">
              书籍简介
            </td>
            <td align="center" width="20px">
              书籍归类
            </td>
            <td align="center" width="10px">
              书籍价格
            </td>
            <td align="center" width="20px">
              出版社
            </td>
            <td align="center" width="30px">
              发布日期
            </td>
            <td align="center" width="10px">
              是否热门
            </td>
            <td width="7%" align="center">
              修改|删除
            </td>
          </tr>
          <c:forEach var="p" items="${page.list}" varStatus="status">
            <tr onmouseover="this.style.backgroundColor = 'white'"
                onmouseout="this.style.backgroundColor = '#F5FAFE';">
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="5px">
                  ${status.count}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="10px">
                  ${p.bname}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                  ${p.auto}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="10px">
                  <img src="${pageContext.request.contextPath}/web-image/book-image/${p.image}">
                  <%--${p.image}--%>
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                  ${p.desc}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                             width="20px">
                ${p.category}
            </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                  ${p.price}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                  ${p.publishingHouse}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                  ${p["delivery_time"]}
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                <c:choose>
                  <c:when test="${p['is_Hot']==1}">是</c:when>
                  <c:otherwise>否</c:otherwise>
                </c:choose>
              </td>
              <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                  width="20px">
                <a href="${pageContext.request.contextPath}/app/book/showBookMessage?bsid=${p.bsid}" style="text-decoration: none">修改</a>|
                <a href="${pageContext.request.contextPath}/app/book/deleteBook?bsid=${p.bsid}" style="text-decoration: none" onclick="return confirm('确定要删除吗？')">删除</a>

              </td>
          </c:forEach>
        </table>
  <table>
      <div align="center" style="color: white">
          第${page. pageNum}页/共${page.pages}页
          <hr>
          <a style="color:red;text-decoration: none" href="${pageContext.request.contextPath}/app/book/pageBean?currentPage=1">首页</a>
          <c:if test="${page.hasPreviousPage}">
              <a style="color: red;text-decoration: none"  href="${pageContext.request.contextPath}/app/book/pageBean?currentPage=${page.prePage}">上一页</a>
          </c:if>
          <c:forEach var="num" begin="1" end="${page.pages}">
              <c:choose>
                  <c:when test="${num==page.pageNum}">
                      ${num}
                  </c:when>
                  <c:otherwise>
                      <a style="color:red;text-decoration: none" href="${pageContext.request.contextPath}/app/book/pageBean?currentPage=${num}">[${num}]</a>
                  </c:otherwise>
              </c:choose>
          </c:forEach>
          <c:if test="${page.hasNextPage}">
              <a style="color:red;text-decoration: none" href="${pageContext.request.contextPath}/app/book/pageBean?currentPage=${page.nextPage}">下一页</a>
          </c:if>
          <a style="color: red;text-decoration: none" href="${pageContext.request.contextPath}/app/book/pageBean?currentPage=${page.pages}">尾页</a>




      </div>
  </table>

</body>


</HTML>
